//1、自定义every
function myEvery(fn, arr) {
  for (let i = 0; i < arr.length; i++) {
    res = fn(arr[i], i, arr)
    if (!res) {
      return false
    }
  }
  return true
}
var arr1 = [true, false, false, true, true]
var arr2 = [true, true, true, true, true]
var result1 = myEvery(function (item) {
  return item
}, arr1)
var result2 = myEvery(function (item) {
  return item
}, arr2)
console.log(result1, result2)

var obj = {
  10: '十',
  1: '一',
  2: '二',
  3: '三',
  4: '四',
  5: '五',
  6: '六',
  7: '七',
  8: '八',
  9: '九',
  0: '零',
}
Number.prototype.decode = function (num) {
  let num2 = this.valueOf()
  let num1 = this.valueOf().toString()
  let str = ''
  if (num2 == 10) {
    return obj['10']
  }
  if (num2 > 10 && num2 < 20) {
    let num = num2 % 10
    return obj['10'] + obj[num.toString()]
  }
  if (num2 % 10 == 0 && num2 < 100) {
    let num = num2 / 10
    if (num == 0) {
      num = 6
    }
    return obj[num.toString()] + obj['10']
  }
  for (let i in num1) {
    if (i == 1 && num2 > 20 && num2 < 1000) {
      str += obj['10']
    }
    str += obj[num1[i]]
  }
  return str
}

const myTime = function () {
  const mydate = new Date()
  const year = mydate.getFullYear().decode()
  const month = (mydate.getMonth() + 1).decode()
  const date = mydate.getDate().decode()
  const hour = mydate.getHours().decode()
  const minutes = mydate.getMinutes().decode()
  const seconds = mydate.getSeconds().decode()
  str = `${year}年-${month}月-${date}日 ${hour}时:${minutes}分:${seconds}秒`
  console.log(str)
}
setInterval(myTime, 1000)
console.log()
